home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 526-550 / disk_537 / chip8 / chip8.s < prev    next >
Text File  |  1992-05-06  |  24KB  |  1,306 lines

  1. *****************************************
  2. * AMIGA CHIP 8 INTERPRETER & DREAM MON    *
  3. *    started dec 8 90        *
  4. *   (C) Paul Hayter            *
  5. * V1.0 Use con window to enter fnames    *
  6. * 900727                *
  7. * V1.1 added file requester        *
  8. *****************************************
  9.  
  10. * This version uses a 64 x 64 pixel screen (actually 256 x 256 lores)
  11.  
  12.     xref    FileReq        Use sslib Filerequester off FF247
  13.  
  14. * NEED THESE 2 MACROS FOR A68K ASSEMBLER
  15. blo    macro
  16.     bcs \1
  17.     endm
  18.     
  19. bhs    macro
  20.     bcc \1
  21.     endm
  22.  
  23. SIZE_OF_CHIP8_MEMORY    equ    4096
  24.  
  25. ACCESS_READ    equ    -2
  26. MODE_OLDFILE    equ    1005
  27. MODE_NEWFILE    equ    1006
  28. OFFSET_END    equ    1
  29. OFFSET_BEGINNING    equ    -1
  30.  
  31.  
  32. dskdatr    EQU    $008
  33. joy0dat    EQU    $00A
  34. joy1dat    EQU    $00C
  35. clxdat     EQU    $00E
  36.  
  37. pot0dat    EQU    $012
  38. pot1dat    EQU    $014
  39. potinp     EQU    $016
  40. intenar    EQU    $01C
  41. intreqr    EQU    $01E
  42.  
  43. vposw      EQU    $02A
  44. vhposw     EQU    $02C
  45. copcon     EQU    $02E
  46. vhposr    equ    $006
  47. vposr    equ    $004
  48.     
  49. cop1lc     EQU    $080
  50. cop2lc     EQU    $084
  51. copjmp1    EQU    $088
  52. copjmp2    EQU    $08A
  53. copins     EQU    $08C
  54. diwstrt    EQU    $08E
  55. diwstop    EQU    $090
  56. ddfstrt    EQU    $092
  57. ddfstop    EQU    $094
  58. dmacon     EQU    $096
  59. clxcon     EQU    $098
  60. intena     EQU    $09A
  61. intreq     EQU    $09C
  62. adkcon     EQU    $09E
  63.  
  64. aud        EQU    $0A0
  65. aud0       EQU    $0A0
  66. aud1       EQU    $0B0
  67. aud2       EQU    $0C0
  68. aud3       EQU    $0D0
  69.  
  70.  
  71. bpl1pth      EQU    $0E0
  72. bpl1ptl    equ    $0e2
  73. bpl2pth    equ    $0e4
  74. bpl2ptl    equ    $0e6
  75.  
  76. bplcon0    EQU    $100
  77. bplcon1    EQU    $102
  78. bplcon2    EQU    $104
  79. bpl1mod    EQU    $108
  80. bpl2mod    EQU    $10A
  81.  
  82. bpldat     EQU    $110
  83.  
  84. spr0pth      EQU    $120
  85. spr0ptl      EQU    $122
  86. spr1pth      EQU    $124
  87. spr1ptl      EQU    $126
  88. spr2pth    EQU    $128
  89. spr2ptl    EQU    $12A
  90.  
  91. spr        EQU    $140
  92.  
  93. color00      EQU    $180
  94. color01    equ    $0182
  95. color02    equ    $184
  96. color03    equ    $186
  97. color17    equ    $1a2
  98. color18    equ    $1a4
  99. color19    equ    $1a6
  100. color20    equ    $1a8
  101. color21    equ    $1aa
  102.  
  103.  
  104. *   A6= gfxbase
  105. *   A5= chip8 program counter
  106. *   A4= ptr to chip ram workspace
  107. *    +0   = screen
  108. *    -16  = chip8 variables
  109. *    -18  = I memory ptr (16 bit word, only 12 its used.
  110. *   A3= $dff000
  111.  
  112. chip_block    equ    1000
  113. param_area    equ    1000
  114.  
  115.  
  116. **negative equates in the chip block
  117. variables        equ    -16
  118. Iptr        equ    variables-2
  119. old_copper    equ    Iptr-4
  120. stack_ptr        equ    old_copper-4
  121. stack_lower    equ    stack_ptr-256    256 byte call stack
  122. intbase        equ    stack_lower-4
  123. screen        equ    intbase-4
  124. screen_addr    equ    screen-4
  125. window        equ    screen_addr-4
  126. timer        equ    window-2
  127. last_key        equ    timer-2
  128. last_time        equ    last_key-2
  129. dosbase        equ    last_time-4
  130. mon_addr        equ    dosbase-2
  131. count        equ    mon_addr-2
  132. hex_bump        equ    count-2
  133. con_handle    equ    hex_bump-4
  134. file_string    equ    con_handle-64
  135. file_handle    equ    file_string-4
  136. start_addr    equ    file_handle-2
  137. file_size        equ    start_addr-4
  138. rand_seed        equ    file_size-2
  139. WBenchScreen    equ    rand_seed-4
  140. screen_bound    equ    WBenchScreen-4
  141.  
  142. LOFlist        equ    $32
  143. left_mouse    equ    $bfe001
  144. keyboard        equ    $bfec01
  145. timerA        equ    $bfe801
  146.  
  147. _LVOSeek        equ    -66
  148. _LVOClose        equ    -36
  149. _LVOOpen        equ    -30
  150. _LVORead        equ    -42
  151. _LVOWrite        equ    -48
  152.     
  153. _LVOText        equ    -60
  154. _LVOInitRastPort    equ    -198
  155. _LVOMove        equ    -240
  156. _LVOInitBitMap    equ    -390
  157. _LVOSetAPen    equ    -342
  158. _LVOSetBPen    equ    -348
  159. _LVORectFill    equ    -306
  160. _LVOReadPixel    equ    -318
  161. _LVOWritePixel    equ    -324
  162. _LVOSetRast    equ    -234
  163. _LVOWaitTOF    equ    -270
  164. _LVOVBeamPos    equ    -384
  165.     
  166. _LVOOpenScreen    equ    -198
  167. _LVOCloseScreen    equ    -66
  168. _LVOOpenWindow    equ    -204
  169. _LVOCloseWindow    equ    -72
  170. _LVOScreenToBack    equ    -246
  171. _LVOScreenToFront    equ    -252
  172.  
  173. custom        equ    $dff000
  174. _LVOOpenLibrary    equ    -552
  175. _LVOCloseLibrary    equ    -414
  176. _LVOAllocMem    equ    -198
  177. _LVOFreeMem    equ    -210
  178. _LVOForbid    equ    -132
  179. _LVOPermit    equ    -138
  180.  
  181. rp_BitMap        equ    4
  182. bm_Planes        equ    8
  183.  
  184. sc_BitMap        equ    184
  185. sc_RastPort    equ    84
  186.  
  187.     section ethel,code        code_c
  188.  
  189. *CLI/WORKBENCH STARTUP CODE
  190. _AbsExecBase    equ    4
  191. _LVOFindTask    equ    -294
  192. pr_CLI        equ    172
  193. pr_MsgPort    equ    92
  194. _LVOWaitPort    equ    -384
  195. _LVOGetMsg    equ    -372
  196. *_LVOForbid    equ    -132
  197. _LVOReplyMsg    equ    -378
  198.  
  199.  
  200. startup:            ; reference for Wack users
  201.     move.l   sp,initialSP   ; initial task stack pointer
  202.  
  203.     ;------ get Exec's library base pointer:
  204.     move.l   _AbsExecBase,a6
  205.  
  206.     ;------ get the address of our task
  207.     suba.l   a1,a1
  208.     jsr    _LVOFindTask(a6)
  209.     move.l   d0,a4
  210.  
  211.     ;------ are we running as a son of Workbench?
  212.     tst.l   pr_CLI(A4)
  213.     beq.s   fromWorkbench
  214.  
  215. ;=======================================================================
  216. ;====== CLI Startup Code ===============================================
  217. ;=======================================================================
  218. fromCLI:
  219.  
  220.  
  221.     ;------ call C main entry point
  222.     jsr   _main
  223.  
  224.     ;------ return success code:
  225.     moveq.l   #0,D0
  226.     move.l   initialSP,sp   ; restore stack ptr
  227.     rts
  228.  
  229. ;=======================================================================
  230. ;====== Workbench Startup Code =========================================
  231. ;=======================================================================
  232. fromWorkbench:
  233.  
  234.     ;------ we are now set up.  wait for a message from our starter
  235.     bsr.s   waitmsg
  236.  
  237.     ;------ save the message so we can return it later
  238.     move.l   d0,_WBenchMsg
  239.  
  240.     ;------ push the message on the stack for wbmain
  241.     move.l   d0,-(SP)
  242.     clr.l   -(SP)      indicate: run from Workbench
  243.  
  244. domain:
  245.     jsr   _main
  246.     moveq.l   #0,d0      Successful return code
  247.     move.l  initialSP,SP   ; restore stack pointer
  248.     move.l   d0,-(SP)   ; save return code
  249.  
  250.     move.l   _AbsExecBase,A6
  251.  
  252.     ;------ if we ran from CLI, skip workbench cleanup:
  253.     tst.l   _WBenchMsg
  254.     beq.s   exitToDOS
  255.  
  256.  
  257.     ;------ return the startup message to our parent
  258.     ;------   we forbid so workbench can't UnLoadSeg() us
  259.     ;------   before we are done:
  260.     jsr    _LVOForbid(a6)
  261.     move.l   _WBenchMsg,a1
  262.     jsr    _LVOReplyMsg(a6)
  263.  
  264.     ;------ this rts sends us back to DOS:
  265. exitToDOS:
  266.     move.l   (SP)+,d0
  267.     rts
  268.  
  269.  
  270. ;-----------------------------------------------------------------------
  271. ; This routine gets the message that workbench will send to us
  272. ; called with task id in A4
  273.  
  274.  
  275. waitmsg:
  276.     lea   pr_MsgPort(A4),a0     * our process base
  277.     jsr    _LVOWaitPort(a6)
  278.     lea   pr_MsgPort(A4),a0     * our process base
  279.     jsr    _LVOGetMsg(a6)
  280.     rts
  281.  
  282.  
  283. ************************************************************************
  284.  
  285.    DATA
  286.  
  287. ************************************************************************
  288.  
  289.  
  290.  
  291. initialSP   dc.l   0
  292. _WBenchMsg   dc.l   0
  293.  
  294. _main
  295.  
  296. ********PUT YOUR PROGRAM HERE***************************
  297.  
  298.  
  299.  
  300. START    move.l    4,a6
  301.     bsr    allocate_chip
  302.     tst.l    d0
  303.     beq    exit1
  304.     move.l    d0,a4
  305.     add.l    #param_area,a4    A4=workspace
  306.     lea    gfxname(pc),a1
  307.     moveq    #0,d0
  308.     jsr    _LVOOpenLibrary(a6)
  309.     move.l    d0,a5
  310.     lea    intname(pc),a1
  311.     moveq    #0,d0
  312.     jsr    _LVOOpenLibrary(a6)
  313.     move.l    d0,intbase(a4)
  314.     move.l    d0,a1
  315.     move.l    56(a1),WBenchScreen(a4)    get the initial screen
  316.     lea    dosname(pc),a1
  317.     moveq    #0,d0
  318.     jsr    _LVOOpenLibrary(a6)
  319.     move.l    d0,dosbase(a4)
  320.     move.l    a5,a6        A6=gfxbase
  321.     
  322.     lea    custom,a3        A3=custom
  323.     lea    area_base+$0600,a5    A5=program counter
  324.     move.b    timerA,last_time(a4)
  325.     clr.b    file_string(a4)    make sure we have null filename
  326.     bsr    clear_memory    PUT DIGIT/mon IN AREA_BASE+CLEAR
  327.     bsr    setup_screen
  328. *    bsr    chip8_interpreter
  329.     bsr    DREAM_MON
  330.     bsr    close_screen
  331.  
  332.     move.l    a6,a1
  333.     move.l    4,a6
  334.     jsr    _LVOCloseLibrary(a6)    close gfx
  335.     move.l    intbase(a4),a1
  336.     jsr    _LVOCloseLibrary(a6)    close int
  337.     move.l    dosbase(a4),a1
  338.     jsr    _LVOCloseLibrary(a6)
  339.     bsr    free_chip
  340. exit1    moveq    #0,d0
  341.     rts
  342.  
  343. chip8_interpreter
  344.     bsr    init_chip8
  345. ch82
  346. *    jsr    _LVOWaitTOF(a6)
  347.  
  348. *    move.l    #20,d0
  349. *ch89    subq.l    #1,d0
  350. *    bne.s    ch89    
  351.     
  352. add_time    move.b    timerA,d0
  353.     move.b    d0,d1
  354.     sub.b    last_time(a4),d0
  355.     move.b    d1,last_time(a4)
  356.     sub.b    d0,timer(a4)
  357.  
  358.     btst    #6,left_mouse
  359.     bne.s    no_press
  360.     rts
  361. no_press
  362.     moveq    #0,d0
  363.     move.b    (a5)+,-(sp)
  364.     move.w    (sp)+,d0        shove in high byte
  365.     move.b    (a5)+,d0        get next byte
  366.     move.w    d0,d1        D1 = copy of command.
  367.     move.w    d0,d2
  368.     lea    variables(a4),a2
  369.     lsr.w    #4,d2
  370.     and.w    #$000F,d2
  371.     lea    0(a2,d2.w),a1    A1 ->y variable
  372.     move.w    d0,d2
  373.     lsr.w    #8,d2
  374.     and.w    #$000F,d2
  375.     lea    0(a2,d2.w),a0    A0 ->x variable    
  376.     lsl.l    #5,d0
  377.     swap    d0
  378.     bclr    #0,d0
  379.     lea    command_list(pc),a2
  380.     move.w    0(a2,d0.w),d0    get word address
  381.     lea    START(pc),a2
  382.     jsr    0(a2,d0.w)    jump to command
  383.     bra    ch82
  384.  
  385. command_list    dc.w    com0-START,com1-START,com2-START
  386.         dc.w    com3-START,com4-START,com5-START
  387.         dc.w    com6-START,com7-START,com8-START
  388.         dc.w    com9-START,comA-START,comB-START
  389.         dc.w    comC-START,comD-START,comE-START
  390.         dc.w    comF-START
  391.  
  392. init_chip8
  393.     bsr    erase_scr
  394.     lea    stack_ptr(a4),a0
  395.     move.l    a0,stack_ptr(a4)
  396.     rts
  397.  
  398. DREAM_MON
  399.     move.w    #$0200,mon_addr(a4)        DREAM ON!!
  400.     bsr    erase_scr
  401. dm_st    bsr    show_bar
  402.     bsr    show_addr
  403.     addq.b    #8,variables(a4)
  404.     move.w    mon_addr(a4),d6
  405.     moveq    #0,d7
  406.     lea    area_base,a0
  407.     move.b    0(a0,d6.w),d7
  408.     move.b    d7,-(sp)
  409.     lsr.b    #4,d7
  410.     bsr    show_digit    MSD
  411.     move.b    (sp)+,d7
  412.     and.b    #$0f,d7
  413.     addq.b    #4,variables(a4)
  414.     bsr    show_digit    LSD
  415.     moveq    #2,d0
  416.     bsr    wait_for_key    WAIT FOR KEY
  417.     cmp.b    #$0F,d2
  418.     bhi.s    mon_command
  419.     move.w    mon_addr(a4),d0    ENTER HEX DIGITS
  420.     lea    area_base,a0
  421.     move.b    0(a0,d0.w),d1
  422.     lsl.b    #4,d1        =0Y
  423.     or.b    d1,d2
  424.     move.b    d2,0(a0,d0.w)
  425.     addq.b    #1,hex_bump(a4)
  426.     cmp.b    #2,hex_bump(a4)
  427.     blo.s    dm_st
  428.     clr.b    hex_bump(a4)
  429.     addq.w    #1,mon_addr(a4)
  430.     bra    dm_st
  431. mon_command
  432.     clr.b    hex_bump(a4)
  433.     cmp.b    #'M',d2
  434.     bne.s    not_M
  435.     move.w    #4,count(a4)
  436. mc_1    bsr    show_bar
  437.     bsr    show_addr
  438.     moveq    #2,d0
  439.     bsr    wait_for_key        GET KEY
  440.     move.w    mon_addr(a4),d3
  441.     lsl.w    #4,d3
  442.     or.w    d3,d2
  443.     move.w    d2,mon_addr(a4)
  444.     subq.w    #1,count(a4)
  445.     bne.s    mc_1
  446.     bra    dm_st
  447. not_M    cmp.b    #'+',d2
  448.     bne.s    not_fwd
  449.     addq.w    #1,mon_addr(a4)
  450.     bra    dm_st
  451. not_fwd    cmp.b    #'-',d2
  452.     bne.s    not_bwd
  453.     subq.w    #1,mon_addr(a4)
  454.     bra    dm_st
  455. not_bwd    cmp.b    #'G',d2
  456.     bne.s    not_go
  457.     move.w    mon_addr(a4),d0        execute CHIP8 prog at current
  458.     lea    area_base,a0
  459.     lea    0(a0,d0.w),a5
  460.     bsr    do_forbid
  461.     bsr    chip8_interpreter
  462.     bsr    do_permit
  463. still_press
  464. *    btst    #6,left_mouse
  465. *    beq.s    still_press
  466.     bra    dm_st
  467. not_go    cmp.b    #'L',d2
  468.     bne.s    not_L
  469.     lea    load_title(pc),a1
  470.     lea    file_string(a4),a0
  471.     bsr    do_filerequester
  472.     tst.l    d0
  473.     beq    dm_st        error
  474.     bmi    dm_st        selected cancel
  475.     bsr    read_file
  476.     tst.l    d0
  477.     beq    dm_st        error!
  478.     bsr    rll_decompress
  479.     bra    dm_st
  480. not_L    cmp.b    #'S',d2
  481.     bne.s    not_S
  482.     lea    save_title(pc),a1
  483.     lea    file_string(a4),a0
  484.     bsr    do_filerequester
  485.     tst.l    d0
  486.     beq    dm_st        error!
  487.     bmi    dm_st        selected cancel!
  488.     bsr    rll_compress    compress workspace!
  489.     bsr    write_file
  490.     bra    dm_st
  491.  
  492. not_S    cmp.b    #'X',d2        EXIT
  493.     bne    not_X
  494.     rts
  495. not_X    cmp.b    #'K',d2        KLEAR
  496.     bne    dm_st
  497.     bsr    clear_memory
  498.     bra    dm_st
  499.  
  500.     
  501.     
  502. show_addr    move.b    #26,variables+1(a4)    V1=26
  503.     move.b    #16,variables(a4)    V0=16
  504.     moveq    #0,d7
  505.     moveq    #3,d6
  506.     move.w    mon_addr(a4),d7
  507. dm_2    lsl.l    #4,d7        SHOW ADDRESS
  508.     swap    d7
  509.     bsr    show_digit
  510.     clr.w    d7
  511.     swap    d7
  512.     addq.b    #4,variables(a4)    bump x
  513.     dbra    d6,dm_2
  514.     rts
  515.     
  516.     
  517. show_digit    
  518.     move.w    d7,d5    x 1
  519.     lsl.w    #2,d5    x 4
  520.     add.w    d7,d5    x 5
  521.     move.w    d5,Iptr(a4)
  522.     movem.l    d6-d7,-(sp)
  523.     move.w    #$D015,d1
  524.     lea    variables(a4),a0
  525.     lea    variables+1(a4),a1
  526.     bsr    displ
  527.     movem.l    (sp)+,d6-d7
  528.     rts
  529.  
  530. show_bar    move.l    screen_addr(a4),a1
  531.     lea    3200(a1),a1
  532.     move.w    #224-1,d0
  533.     moveq    #-1,d1
  534. dm_1    move.l    d1,(a1)+        WHITE BAR
  535.     dbra    d0,dm_1
  536.     rts
  537.     
  538. * 00EE=return, 00E0=erase,
  539. com0    cmp.w    #$00EE,d1
  540.     bne    not_return
  541.     bsr    pull_address
  542.     lea    area_base,a0
  543.     lea    0(a0,d0.w),a5
  544.     rts
  545. not_return
  546.     cmp.w    #$00E0,d1
  547.     bne    not_erase
  548. erase_scr    move.l    screen(a4),a1
  549.     lea    sc_RastPort(a1),a1
  550.     moveq    #0,d0
  551.     jsr    _LVOSetRast(a6)
  552.     jsr    _LVOWaitTOF(a6)
  553.     jmp    _LVOWaitTOF(a6)
  554. not_erase    
  555.     rts        NEED TO ALLOW FOR 0MMM instructions
  556.  
  557. push_address
  558.     move.l    stack_ptr(a4),a0
  559.     move.w    d0,-(a0)
  560.     move.l    a0,stack_ptr(a4)
  561.     rts
  562.     
  563. pull_address
  564.     move.l    stack_ptr(a4),a0
  565.     moveq    #0,d0
  566.     move.w    (a0)+,d0
  567.     move.l    a0,stack_ptr(a4)
  568.     rts
  569.     
  570. * GOTO MMM
  571. com1    and.w    #$0FFF,d1
  572.     lea    area_base,a0
  573.     lea    0(a0,d1.w),a5
  574.     rts
  575.  
  576. * DO MMM
  577. com2    sub.l    #area_base,a5
  578.     move.l    a5,d0
  579.     bsr    push_address
  580.     bra    com1        goto address
  581.  
  582.  
  583. ** SKF VX = KK  3XKK
  584. com3    cmp.b    (a0),d1
  585.     bne    com3_fail
  586.     move.w    (a5)+,d0
  587. com3_fail    rts
  588.  
  589. ** SKF VX <> KK
  590. com4    cmp.b    (a0),d1
  591.     beq    com4_fail
  592.     move.w    (a5)+,d0
  593. com4_fail    rts
  594.  
  595. ** SKF VX = VY    5XY0
  596. com5    cmp.b    (a0)+,(a1)+    don't need post +,but illegal addr mode
  597.     bne    com5_fail
  598.     move.w    (a5)+,d0
  599. com5_fail    rts
  600.  
  601. ** VX = KK   6XKK
  602. com6    move.b    d1,(a0)
  603.     rts
  604.     
  605. ** VX= VX+KK
  606. com7    add.b    d1,(a0)
  607.     rts
  608.  
  609.  
  610. ** 8XYn
  611. com8    move.b    d1,d2
  612.     and.b    #$0F,d2
  613.     cmp.b    #$0,d2
  614.     bne.s    try_01
  615.     move.b    (a1),(a0)        VX=VY
  616.     rts
  617. try_01    cmp.b    #$1,d2
  618.     bne.s    try_02
  619.     move.b    (a1),d3
  620.     or.b    d3,(a0)
  621.     rts
  622. try_02    cmp.b    #$2,d2
  623.     bne.s    try_03
  624.     move.b    (a1),d3
  625.     and.b    d3,(a0)
  626.     rts
  627. try_03    cmp.b    #$3,d2
  628.     bne.s    try_04
  629.     move.b    (a1),d3
  630.     eor.b    d3,(a0)
  631.     rts
  632. try_04    cmp.b    #$4,d2
  633.     bne.s    try_05
  634.     moveq    #0,d4
  635.     move.b    (a0),d3
  636.     add.b    (a1),d3
  637.     bcc.s    try04a
  638.     moveq    #1,d4
  639. try04a    move.b    d4,variables+15(a4)    VF=1
  640.     move.b    d3,(a0)
  641.     rts
  642. try_05    cmp.b    #$5,d2
  643.     bne.s    exit8
  644.     moveq    #1,d4
  645.     move.b    (a0),d3
  646.     sub.b    (a1),d3
  647.     bcc.s    try05a
  648.     moveq    #0,d4
  649. try05a    move.b    d4,variables+15(a4)
  650.     move.b    d3,(a0)
  651. exit8    rts
  652.     
  653.     
  654. ** SKF VX <> VY
  655. com9    cmp.b    (a0)+,(a1)+
  656.     beq.s    com9_fail
  657.     move.w    (a5)+,d0
  658. com9_fail    rts
  659.  
  660.  
  661. ** I = MMM
  662. comA    and.w    #$0FFF,d1
  663.     move.w    d1,Iptr(a4)
  664.     rts
  665.  
  666.  
  667. * GOTO MMM + V0
  668. comB    and.w    #$0FFF,d1
  669.     moveq    #0,d0
  670.     move.b    variables(a4),d0    GET V0
  671.     add.w    d0,d1
  672.     bra    com1
  673.  
  674. * CXKK    I don't know how to write random number generators!
  675. comC
  676.     move.w    rand_seed(a4),d2
  677. *    move.w    rand_seed(a4),d1
  678. *    addq.w    #1,rand_seed(a4)
  679.     mulu    #41693,d2
  680.     addq.w    #1,d2
  681.     move.w    d2,rand_seed(a4)
  682.     lsr.w    #8,d2
  683.     and.b    d2,d1
  684. *    eor.b    #$ff,d1
  685.     move.b    d1,(a0)
  686.     rts
  687.  
  688.  
  689. ** DISP N @ (X,Y)
  690. comD    movem.l    a0-a1/d1,-(sp)
  691. comDbeam    jsr    _LVOVBeamPos(a6)
  692. *    cmp.w    #256+$1c,d0
  693. *    blo.s    comDbeam
  694.     cmp.l    #36,d0
  695.     bhi.s    comDbeam
  696.     
  697.     movem.l    (sp)+,a0-a1/d1
  698. displ    clr.b    variables+15(a4)        VF=0
  699.     move.w    d1,d2            D2=n
  700.     and.w    #$0f,d2
  701.     moveq    #0,d0
  702.     moveq    #0,d1
  703.     move.b    (a1),d0            D0=y
  704.     and.b    #64-1,d0
  705.     move.b    (a0),d1            D1=x
  706.     and.b    #64-1,d1
  707. comD2    move.w    Iptr(a4),d3
  708.     lea    area_base,a0
  709.     lea    0(a0,d3.w),a2    A2=I pointer
  710.     subq.w    #1,d2        D2=line counter
  711.     bsr    calc_scr_addr
  712. drawloop    cmp.l    screen_bound(a4),a1
  713.     blo.s    draw2
  714.     sub.l    #32*4*64,a1
  715. draw2    move.b    (a2)+,d3        D3=byte
  716.     bsr    draw_byte
  717.     dbra    d2,drawloop
  718.     rts
  719.  
  720. ** D0=y,D1=x,d3=byte to draw
  721. draw_byte    moveq    #3,d4    draw 4 lines the same    D4=pixel depth
  722.     moveq    #0,d5
  723.     tst.l    d6
  724.     beq    db3
  725.     lsr.b    #1,d3
  726.     bcc.s    db3
  727.     move.b    #$f0,d5
  728. db3    bsr    quadruple
  729.  
  730. db2    swap    d3        D3=45670123
  731.     move.w    d3,-(sp)
  732.     move.b    (sp)+,d0
  733.     move.b    d0,d1
  734.     cmp.l    screen_bound(a4),a1
  735.     bhs    over_bnd1
  736.     or.b    (a1),d1
  737.     eor.b    d0,(a1)        1st 2 pixels
  738.     cmp.b    (a1)+,d1
  739.     beq.s    ok1
  740.     move.b    #1,variables+15(a4)
  741.  
  742. ok1    move.b    d3,d1
  743.     cmp.l    screen_bound(a4),a1
  744.     bhs    over_bnd2
  745.     or.b    (a1),d1
  746.     eor.b    d3,(a1)        next 2 pixels
  747.     cmp.b    (a1)+,d1
  748.     beq.s    ok2
  749.     move.b    #1,variables+15(a4)
  750.  
  751. ok2    swap    d3
  752.     move.w    d3,-(sp)
  753.     move.b    (sp)+,d0
  754.     move.b    d0,d1
  755.     cmp.l    screen_bound(a4),a1
  756.     bhs    over_bnd3
  757.     or.b    (a1),d1
  758.     eor.b    d0,(a1)        next 2 pixels
  759.     cmp.b    (a1)+,d1
  760.     beq.s    ok3
  761.     move.b    #1,variables+15(a4)
  762.  
  763. ok3    move.b    d3,d1
  764.     cmp.l    screen_bound(a4),a1
  765.     bhs    over_bnd4
  766.     or.b    (a1),d1
  767.     eor.b    d3,(a1)        next 2 pixels
  768.     cmp.b    (a1)+,d1
  769.     beq.s    ok4
  770.     move.b    #1,variables+15(a4)
  771. ok4    move.b    d5,d1
  772.     cmp.l    screen_bound(a4),a1
  773.     bhs    over_bnd5
  774.     or.b    (a1),d1
  775.     eor.b    d5,(a1)        possible next pixel
  776.     cmp.b    (a1)+,d1
  777.     beq.s    ok5
  778.     move.b    #1,variables+15(a4)
  779. ok5    add.l    #27,a1
  780.     dbra    d4,db2
  781.     rts
  782.  
  783. over_bnd1    tst.b    (a1)+
  784. over_bnd2    tst.b    (a1)+
  785. over_bnd3    tst.b    (a1)+
  786. over_bnd4    tst.b    (a1)+
  787. over_bnd5    tst.b    (a1)+
  788.     add.l    #27,a1
  789.     dbra    d4,db2
  790.     rts
  791.  
  792. calc_scr_addr
  793.     moveq    #0,d6
  794.     move.b    d0,d6    D6=y
  795.     lsl.l    #7,d6    x 128
  796.     moveq    #0,d7
  797.     move.b    d1,d7    D7=x
  798.     lsr.l    #1,d7    x 2
  799.     bcs.s    odd_pixel
  800.     add.l    d7,d6
  801.     move.l    screen_addr(a4),a1
  802.     lea    0(a1,d6.l),a1    A1=screen pointer
  803.     moveq    #0,d6        D6=odd pixel indicator
  804.     rts
  805. odd_pixel    add.l    d7,d6
  806.     move.l    screen_addr(a4),a1
  807.     lea    0(a1,d6.l),a1
  808.     moveq    #1,d6
  809.     rts
  810.  
  811. ** D3=byte| exit d3.l=graphic
  812. quadruple    swap    d3    D3=00XX0000
  813.     moveq    #3,d0    
  814. q2    lsr.l    #1,d3
  815.     asr.w    #3,d3
  816.     dbra    d0,q2
  817.     move.w    d3,d1
  818.     moveq    #3,d0
  819. q3    lsr.l    #1,d3
  820.     asr.w    #3,d3
  821.     dbra    d0,q3
  822.     swap    d3
  823.     move.w    d1,d3
  824.     rts
  825.  
  826. ** EXA1 and EX9E
  827. comE    move.b    (a0),d4
  828.     bsr    get_key
  829.     move.b    d2,last_key(a4)
  830.     cmp.b    #$9e,d1
  831.     bne.s    tryA1
  832.     cmp.b    d4,d2
  833.     bne.s    coE1_fail
  834.     move.w    (a5)+,d0
  835. coE1_fail    rts
  836. tryA1    cmp.b    d4,d2
  837.     beq.s    coE2_fail
  838.     move.w    (a5)+,d0
  839. coE2_fail    rts
  840.  
  841. get_key    move.b    timerA,d2
  842.     move.b    d2,-(sp)
  843.     sub.b    last_time(a4),d2
  844.     sub.b    d2,timer(a4)
  845.     move.b    (sp)+,last_time(a4)
  846.     moveq    #0,d2
  847.     move.b    keyboard,d2
  848.     not.b    d2
  849.     lsr.w    #1,d2
  850.     bcc.s    key_down
  851.     moveq    #-1,d2        D2=FF key up
  852.     move.b    d2,last_key(a4)
  853.     rts
  854. key_down    move.l    a0,-(sp)
  855.     lea    key_lookup(pc),a0
  856.     move.b    0(a0,d2.w),d2    GET KEY
  857.     move.l    (sp)+,a0
  858.     rts
  859.  
  860. ******
  861. comF    moveq    #0,d2
  862.     move.b    (a0),d2
  863.  
  864.     cmp.w    #$F000,d1    THIS IS STOP IN THE DREAM CHIP8        NOT IMPLEMENTED   PITCH = VX
  865.     bne.s    not_pitch    BUT IS PITCH=V0 in the ETI 660
  866.     move.l    (sp)+,d0
  867.     rts
  868. not_pitch    cmp.b    #$1e,d1
  869.     bne.s    not_1E
  870.     add.w    Iptr(a4),d2
  871.     move.w    d2,Iptr(a4)
  872.     rts
  873. not_1E    cmp.b    #$07,d1
  874.     bne.s    not_07
  875.     move.b    timer(a4),(a0)    GET CURRENT TIMER VALUE
  876.     rts
  877. not_07    cmp.b    #$0A,d1
  878.     bne.s    not_0A    
  879. loop12
  880.     btst    #6,left_mouse    WAIT FOR KEY
  881.     bne.s    loop120
  882.     move.l    (sp)+,d0
  883.     rts
  884. loop120    bsr    get_key
  885.     tst.b    d2
  886.     bmi.s    loop12
  887.     cmp.b    last_key(a4),d2
  888.     beq.s    loop12
  889.     move.b    d2,last_key(a4)
  890.     move.b    d2,(a0)
  891.     rts
  892. not_0A    cmp.b    #$15,d1
  893.     bne.s    not_15
  894.     move.b    (a0),timer(a4)  SET TIMER
  895.     rts
  896. not_15    cmp.b    #$29,d1
  897.     bne.s    not_29
  898.     and.b    #$0f,d2        I=show digit
  899.     mulu    #5,d2
  900.     move.w    d2,Iptr(a4)
  901.     rts
  902. not_29    cmp.b    #$33,d1
  903.     bne.s    not_33
  904.     move.w    Iptr(a4),d3
  905.     lea    area_base,a0
  906.     divu    #10,d2
  907.     swap    d2
  908.     move.b    d2,2(a0,d3.w)    1's digit
  909.     clr.w    d2
  910.     swap    d2
  911.     divu    #10,d2
  912.     swap    d2
  913.     move.b    d2,1(a0,d3.w)    10's digit
  914.     clr.w    d2
  915.     swap    d2
  916.     divu    #10,d2
  917.     swap    d2
  918.     move.b    d2,0(a0,d3.w)    100's digit
  919.     rts
  920. not_33    cmp.b    #$55,d1
  921.     bne.s    not_55
  922.     move.w    Iptr(a4),d3
  923.     lea    area_base,a2
  924.     lea    variables(a4),a1
  925. loop55    move.b    (a1)+,0(a2,d3.w)  store V0-X @ I
  926.     addq.w    #1,d3
  927.     cmp.l    a0,a1    CMP #@VX,A1
  928.     bls.s    loop55
  929.     move.w    d3,Iptr(a4)
  930.     rts
  931. not_55    cmp.b    #$65,d1
  932.     bne.s    not_65
  933.     move.w    Iptr(a4),d3
  934.     lea    area_base,a2
  935.     lea    variables(a4),a1
  936. loop65    move.b    0(a2,d3.w),(a1)+  load V0-X from I
  937.     addq.w    #1,d3
  938.     cmp.l    a0,a1
  939.     bls.s    loop65
  940.     move.w    d3,Iptr(a4)
  941.     rts
  942. not_65    rts
  943.     
  944.     
  945. wait_for_key
  946. 1$    bsr    get_key
  947.     tst.b    d2
  948.     bmi.s    1$
  949.     cmp.b    last_key(a4),d2
  950.     beq.s    1$
  951.     move.b    d2,last_key(a4)
  952.     rts
  953.  
  954.  
  955. allocate_chip
  956.     move.l    #$10002,d1
  957.     move.l    #chip_block,d0
  958.     jmp    _LVOAllocMem(a6)    allocmem
  959.  
  960. free_chip
  961.     move.l    #chip_block,d0    Deallocate memory
  962.     sub.l    #param_area,a4
  963.     move.l    a4,a1
  964.     move.l    4,a6
  965.     jmp    _LVOFreeMem(a6)
  966.  
  967.  
  968.  
  969. setup_screen
  970.     move.l    a6,-(sp)
  971.     move.l    intbase(a4),a6
  972.     lea    newscreen(pc),a0
  973.     jsr    _LVOOpenScreen(a6)
  974.     move.l    d0,screen(a4)
  975.     move.l    d0,nw_Screen
  976.     move.l    d0,a0
  977.     lea    sc_BitMap(a0),a0
  978.     move.l    bm_Planes(a0),d0
  979. *    add.l    #32*12,d0
  980.     move.l    d0,screen_addr(a4)
  981.     add.l    #32*4*64,d0
  982.     move.l    d0,screen_bound(a4)
  983.     lea    newwindow(pc),a0
  984.     jsr    _LVOOpenWindow(a6)
  985.     move.l    d0,window(a4)
  986.     move.l    (sp)+,a6
  987.     rts
  988.  
  989. close_screen
  990.     move.l    a6,-(sp)
  991.     move.l    intbase(a4),a6
  992.     move.l    window(a4),a0
  993.     jsr    _LVOCloseWindow(a6)
  994.     move.l    screen(a4),a0
  995.     jsr    _LVOCloseScreen(a6)
  996.     move.l    (sp)+,a6
  997.     rts
  998.  
  999.  
  1000. * Entry A0=filename(0)
  1001. * RETURN D0= 0 if failure
  1002. read_file
  1003.     move.l    a6,-(sp)
  1004.     move.l    dosbase(a4),a6
  1005.     move.l    #MODE_OLDFILE,d2
  1006.     move.l    a0,d1
  1007.     jsr    _LVOOpen(a6)
  1008.     tst.l    d0
  1009.     bne.s    its_actually_here
  1010.     move.l    (sp)+,a6
  1011.     rts
  1012. its_actually_here
  1013.     move.l    d0,file_handle(a4)
  1014.     move.l    d0,d6
  1015.     move.l    d0,d1
  1016.     moveq    #0,d2
  1017.     moveq    #OFFSET_END,d3
  1018.     jsr    _LVOSeek(a6)
  1019.     move.l    d6,d1
  1020.     moveq    #0,d2
  1021.     moveq    #OFFSET_BEGINNING,d3
  1022.     jsr    _LVOSeek(a6)
  1023.     move.l    d0,file_size(a4)
  1024.     clr.w    file_area
  1025.     cmp.l    #SIZE_OF_CHIP8_MEMORY,D0
  1026.     bhs.s    closerd
  1027. load_da_file
  1028. *    move.w    mon_addr(a4),d0
  1029. *    lea    area_base,a0
  1030. *    lea    0(a0,d0.w),a0
  1031.     LEA    file_area,A0    NEW
  1032.     move.l    a0,d2
  1033.     move.l    d6,d1
  1034.     move.l    file_size(a4),d3
  1035.     jsr    _LVORead(a6)
  1036. closerd    move.l    d6,d1
  1037.     jsr    _LVOClose(a6)
  1038.     move.l    (sp)+,a6
  1039.     cmp.w    #$4338,file_area    check if chip8 source file
  1040.     bne.s    1$
  1041.     moveq    #1,d0        return OK
  1042.     rts
  1043. 1$    moveq    #0,d0
  1044.     rts
  1045.     
  1046. * ENTRY A0=filename(0), D0=size
  1047. write_file
  1048.     move.l    a6,-(sp)
  1049.     move.l    d0,d4
  1050.     move.l    dosbase(a4),a6
  1051.     move.l    #MODE_NEWFILE,d2
  1052.     move.l    a0,d1
  1053.     jsr    _LVOOpen(a6)
  1054.     tst.l    d0
  1055.     beq    1$
  1056.     move.l    d0,d6
  1057. *    move.w    mon_addr(a4),d0
  1058. *    lea    area_base,a0
  1059.     lea    file_area,a0
  1060. *    lea    0(a0,d0.w),a0
  1061.     move.l    a0,d2
  1062.     move.l    d6,d1
  1063.     move.l    d4,d3        used to be always 2048 bytes
  1064.     jsr    _LVOWrite(a6)
  1065.     move.l    d6,d1
  1066.     jsr    _LVOClose(a6)
  1067. 1$    move.l    (sp)+,a6
  1068.     rts
  1069.  
  1070.  
  1071.  
  1072. ** ENTRY A0 = filename buffer,A1=requester name
  1073. ** RETURN A0 =filename, D0=0 error, =1 success, =-1 Cancel
  1074. do_filerequester
  1075.     bsr    show_req
  1076.     jsr    FileReq
  1077.     bsr    show_chip8
  1078.     rts
  1079.  
  1080. show_req    
  1081.     movem.l    a0-a1/d0/a6,-(sp)
  1082.     move.l    intbase(a4),a6
  1083.     move.l    WBenchScreen(a4),a0
  1084.     jsr    _LVOScreenToFront(a6)
  1085.     movem.l    (sp)+,a0-a1/d0/a6
  1086.     rts
  1087.  
  1088. show_chip8
  1089.     movem.l    a0-a1/d0/a6,-(sp)
  1090.     move.l    intbase(a4),a6
  1091.     move.l    screen(a4),a0
  1092.     jsr    _LVOScreenToFront(a6)
  1093.     movem.l    (sp)+,a0-a1/d0/a6
  1094.     rts
  1095.  
  1096. copy_stuff
  1097.     lea    area_base,a0
  1098.     lea    digits(pc),a1
  1099.     moveq    #5*16-1,d0
  1100. cd_1    move.b    (a1)+,(a0)+
  1101.     dbra    d0,cd_1
  1102.     rts
  1103.  
  1104. clear_memory
  1105.     movem.l    a0-a1/d0,-(sp)
  1106.     lea    area_base,a0
  1107.     move.w    #SIZE_OF_CHIP8_MEMORY/4-1,d0
  1108. 1$    clr.l    (a0)+
  1109.     dbra    d0,1$
  1110.     bsr    copy_stuff
  1111.     movem.l    (sp)+,a0-a1/d0
  1112.     rts
  1113.  
  1114. ** RLL COMPRESSOR. FILES WILL BE SAVED COMPRESSED
  1115. rll_compress
  1116.     movem.l    a0-a1/d1-d3,-(sp)
  1117.     lea    area_base,a0
  1118.     lea    file_area,a1
  1119.     move.w    #$4338,(a1)+    'C8' for first two chars
  1120.     move.l    #SIZE_OF_CHIP8_MEMORY,d0
  1121.     add.l    a0,d0        D0=end address
  1122.  
  1123. newstart    moveq    #0,d2
  1124.     cmp.l    a0,d0
  1125.     beq    rll_finish
  1126.     move.b    (a0)+,d1
  1127.     cmp.b    (a0),d1
  1128.     bne    1$
  1129.     cmp.b    1(a0),d1
  1130.     beq    byterun
  1131. 1$    move.l    a1,a3
  1132.     tst.b    (a1)+    bump
  1133. sequence    move.b    d1,(a1)+
  1134.     addq.b    #1,d2
  1135.     btst    #7,d2
  1136.     bne    RUN128
  1137.     cmp.l    a0,d0
  1138.     beq    rll_finish2
  1139.     move.b    (a0)+,d1
  1140.     cmp.b    (a0),d1
  1141.     bne    sequence
  1142.     cmp.b    1(a0),d1
  1143.     bne    sequence
  1144.     tst.b    -(a0)    pt to last
  1145. RUN128    subq.b    #1,d2
  1146.     move.b    d2,(a3)
  1147.     bra    newstart
  1148.  
  1149. rll_finish2
  1150.     subq.b    #1,d2
  1151.     move.b    d2,(a3)
  1152. rll_finish
  1153.     sub.l    #file_area,a1
  1154.     move.l    a1,d0
  1155.     movem.l    (sp)+,a0-a1/d1-d3
  1156.     rts
  1157.  
  1158. byterun    move.l    a1,a3
  1159.     tst.b    (a1)+
  1160.     move.b    d1,(a1)+
  1161. runner    addq.b    #1,d2
  1162.     btst    #7,d2
  1163.     bne    RUNNY128
  1164.     cmp.l    a0,d0
  1165.     beq    rll_finish3
  1166.     cmp.b    (a0)+,d1
  1167.     beq    runner
  1168.     tst.b    -(a0)
  1169. RUNNY128    subq.b    #1,d2
  1170.     bset    #7,d2
  1171.     move.b    d2,(a3)
  1172.     bra    newstart
  1173.  
  1174. rll_finish3
  1175.     subq.b    #1,d2
  1176.     bset    #7,d2
  1177.     move.b    d2,(a3)
  1178.     sub.l    #file_area,a1
  1179.     move.l    a1,d0
  1180.     movem.l    (sp)+,a0-a1/d1-d3
  1181.     rts
  1182.  
  1183. ** RLL DECOMPRESSOR
  1184. rll_decompress
  1185.     movem.l    a0-a1/d1-d2/d4,-(sp)
  1186.     lea    file_area,a0    src
  1187.     lea    area_base,a1    dest
  1188.     move.l    a1,d4
  1189.     add.l    #SIZE_OF_CHIP8_MEMORY,d4    D4=end address
  1190.     tst.w    (a0)+    bump over C8 ID
  1191. next_one    moveq    #0,d1
  1192.     cmp.l    a1,d4
  1193.     bls.s    end_decomp
  1194.     move.b    (a0)+,d1
  1195.     bmi.s    decomp_run
  1196. 1$    move.b    (a0)+,(a1)+
  1197.     dbra    d1,1$
  1198.     bra.s    next_one
  1199. decomp_run
  1200.     and.b    #$7f,d1
  1201.     move.b    (a0)+,d2
  1202. 1$    move.b    d2,(a1)+
  1203.     dbra    d1,1$
  1204.     bra.s    next_one
  1205.  
  1206. end_decomp
  1207.     movem.l    (sp)+,a0-a1/d1-d2/d4
  1208.     rts
  1209.  
  1210. do_forbid    move.l    a6,-(sp)
  1211.     move.l    4,a6
  1212.     jsr    _LVOForbid(a6)
  1213.     move.l    (sp)+,a6
  1214.     rts
  1215.     
  1216. do_permit    move.l    a6,-(sp)
  1217.     move.l    4,a6
  1218.     jsr    _LVOPermit(a6)
  1219.     move.l    (sp)+,a6
  1220.     rts
  1221.  
  1222. CUSTOMSCREEN    equ    $000F
  1223. newscreen
  1224.     dc.w    0,0,256,256,1
  1225.     dc.b    1,0
  1226.     dc.w    0
  1227.     dc.w    CUSTOMSCREEN
  1228.     dc.l    0
  1229.     dc.l    0    NO heading
  1230.     dc.l    0
  1231.     dc.l    0
  1232.  
  1233. BORDERLESS              EQU  $0800
  1234. ACTIVATE                EQU  $1000
  1235. WINDOWACTIVE            EQU  $2000
  1236. INREQUEST               EQU  $4000
  1237. MENUSTATE               EQU  $8000
  1238. RMBTRAP                 EQU  $00010000
  1239. NOCAREREFRESH           EQU  $00020000
  1240.  
  1241. newwindow
  1242.     dc.w    0,0,256,256
  1243.     dc.b    1,0
  1244.     dc.l    0
  1245.     dc.l    BORDERLESS+ACTIVATE+NOCAREREFRESH
  1246.     DC.L    0
  1247.     dc.l    0
  1248.     dc.l    0    title
  1249. nw_Screen    dc.l    0
  1250. nw_BitMap    dc.l    0
  1251.     dc.w    256,256,256,256
  1252.     dc.w    CUSTOMSCREEN
  1253.     
  1254.  
  1255. save_title    dc.b 'SAVE FILE',0
  1256. load_title    dc.b 'LOAD FILE',0
  1257.  
  1258. gfxname        dc.b 'graphics.library',0
  1259.  
  1260. intname        dc.b 'intuition.library',0
  1261.  
  1262. dosname        dc.b 'dos.library',0
  1263.  
  1264.  
  1265. ** Increment address uses RETURN,=,SPACE
  1266. ** Decrement address uses - BACKSPACE
  1267.  
  1268. CR    EQU    13
  1269. SPACE    EQU    32
  1270. TAB    EQU    9
  1271. BACKSPACE    EQU    8
  1272. key_lookup
  1273.     dc.b    "`",1,2,3,4,5,6,7,8,9,0,"-+\ ",0,"QW",$E,"RTYUIOP[] ",1,2,3
  1274.     dc.b    $A,"S",$D,$F,"GHJKL;'~ ",4,5,6," ZX",$C,"V",$B,"NM,./"
  1275.     DC.B    "  ",7,8,9,'+-',TAB,"++"
  1276.     DC.B    $1B,$7F,$A,$B,$C,$E,$D,"-++-"
  1277.  
  1278.     even
  1279.  
  1280. digits    dc.b    $e0,$a0,$a0,$a0,$e0
  1281.     dc.b    $40,$40,$40,$40,$40
  1282.     dc.b    $e0,$20,$e0,$80,$e0
  1283.     dc.b    $e0,$20,$e0,$20,$e0
  1284.     dc.b    $80,$a0,$a0,$e0,$20
  1285.     dc.b    $e0,$80,$e0,$20,$e0
  1286.     dc.b    $e0,$80,$e0,$a0,$e0
  1287.     dc.b    $e0,$20,$20,$20,$20        7
  1288.     dc.b    $e0,$a0,$e0,$a0,$e0        8
  1289.     dc.b    $e0,$a0,$e0,$20,$e0        9
  1290.     dc.b    $e0,$a0,$e0,$a0,$a0        A
  1291.     dc.b    $c0,$a0,$e0,$a0,$c0        B
  1292.     dc.b    $e0,$80,$80,$80,$e0        C
  1293.     dc.b    $c0,$a0,$a0,$a0,$c0        D
  1294.     dc.b    $e0,$80,$e0,$80,$e0        E
  1295.     dc.b    $e0,$80,$c0,$80,$80        F
  1296.  
  1297. * This will never get printed, but its to make sure this program can
  1298. * be identified
  1299. ego    dc.b    'CHIP 8 Emulator V1.1 (C)1990,91 Paul Hayter',0
  1300.     
  1301.  
  1302.     section program_area,bss
  1303. area_base    ds.b    SIZE_OF_CHIP8_MEMORY
  1304. file_area    ds.b    SIZE_OF_CHIP8_MEMORY+100
  1305.     end
  1306.